<?php


namespace App\Remote\Feishu\Departments;


use Closure;
use Symfony\Component\HttpFoundation\Response as ResponseAlias;

class Remote extends \App\Remote\Remote
{

    /**
     * @inheritDoc
     */
    static function getBaseUri(): string
    {
        // TODO: Implement getBaseUri() method.
        return "https://open.feishu.cn";
    }

    /**
     * @return Closure
     */
    public static function registerResponseHandle(): Closure
    {
        return function () {
            list($responseHttpCode, $responseContents) = func_get_args();
            if ($responseHttpCode == ResponseAlias::HTTP_OK && isJson($responseContents)) {
                return json_decode($responseContents, JSON_UNESCAPED_UNICODE)["data"];
            }
            throw new \Exception("获取部门信息失败");
        }; // TODO: Change the autogenerated stub
    }

}
